@extends('layouts.default')
@section('content') 
<div class="box">
    <header>
        <div class="icons">
            <i class="fa fa-list"></i>
        </div>
        <h5>{{ Lang::get('messages.maintenance_report')}}</h5>
        <div id="print"></div>
    </header>
    <div class="body">         
        <h2>{{Lang::get('messages.maintenance')}}</h2>
        @foreach ($maintenance as $m)
        @if(
        ((Helpers\Helper::status_maintenance($m->milage, $m->km_due, $m->maint_milage) >= 0) 
        && (Helpers\Helper::status_maintenance($m->milage, $m->km_due, $m->maint_milage) <= 4))
        && ((Helpers\Helper::status_date($current_date, $m->month_due, $m->maintenance_date) >= 5) 
        && (Helpers\Helper::status_date($current_date, $m->month_due, $m->maintenance_date) <= 20))
        )  
        <p class="text-warning">{{ $m->Make }}{{ $m->License}} {{Lang::get('messages.maintenance_limit')}}. </p>
        <p class="text-info"> {{Lang::get('messages.maintenance_date_expired')}}
            {{ Helpers\Helper::next_date($m->maintenance_date, $m->month_due) }}
            {{Lang::get('messages.maintenance_limit_milage')}} {{  $m->km_due + $m->maint_milage}}</p>
        @elseif(
        ((Helpers\Helper::status_maintenance($m->milage, $m->km_due, $m->maint_milage) >= 0) 
        && (Helpers\Helper::status_maintenance($m->milage, $m->km_due, $m->maint_milage) <= 4))
        && ((Helpers\Helper::status_date($current_date, $m->month_due, $m->maintenance_date) >= 21))
        )  
        <p class="text-danger">{{ $m->Make }}{{ $m->License}} {{Lang::get('messages.maintenance_expired')}}.</p> 
        <p class="text-info">{{Lang::get('messages.maintenance_date_expired')}} 
            {{ Helpers\Helper::next_date($m->maintenance_date, $m->month_due)}}
            {{Lang::get('messages.maintenance_limit_milage')}} {{ $m->km_due + $m->maint_milage}}
        </p>

        @elseif (
        ((Helpers\Helper::status_maintenance($m->milage, $m->km_due, $m->maint_milage) >= 5) 
        && (Helpers\Helper::status_maintenance($m->milage, $m->km_due, $m->maint_milage) <= 20))
        && ((Helpers\Helper::status_date($current_date, $m->month_due, $m->maintenance_date) >= 0) 
        && (Helpers\Helper::status_date($current_date, $m->month_due, $m->maintenance_date) <= 4))
        )
        <p class="text-warning">{{ $m->Make }}{{ $m->License}} {{Lang::get('messages.maintenance_limit')}}.</p>
        <p class="text-info">{{Lang::get('messages.maintenance_date_expired')}} 
            {{ Helpers\Helper::next_date($m->maintenance_date, $m->month_due)}}
            {{Lang::get('messages.maintenance_limit_milage')}} {{ $m->km_due + $m->maint_milage}}</p>
        @elseif (
        ((Helpers\Helper::status_maintenance($m->milage, $m->km_due, $m->maint_milage) >= 5) 
        && (Helpers\Helper::status_maintenance($m->milage, $m->km_due, $m->maint_milage) <= 20))
        && ((Helpers\Helper::status_date($current_date, $m->month_due, $m->maintenance_date) >= 5) 
        && (Helpers\Helper::status_date($current_date, $m->month_due, $m->maintenance_date) <= 20))
        )
        <p class="text-warning">{{ $m->Make }}{{ $m->License}} {{Lang::get('messages.maintenance_limit')}}. </p>
        <p class="text-info">  {{Lang::get('messages.maintenance_date_expired')}} 
            {{ Helpers\Helper::next_date($m->maintenance_date, $m->month_due)}}
            {{Lang::get('messages.maintenance_limit_milage')}} {{ $m->km_due + $m->maint_milage}}</p>
        @elseif (
        ((Helpers\Helper::status_maintenance($m->milage, $m->km_due, $m->maint_milage) >= 5) 
        && (Helpers\Helper::status_maintenance($m->milage, $m->km_due, $m->maint_milage) <= 20))
        && ((Helpers\Helper::status_date($current_date, $m->month_due, $m->maintenance_date) >= 21))
        )
        <p class="text-danger">{{ $m->Make }}{{ $m->License}} {{Lang::get('messages.maintenance_expired')}}.</p>
        <p class="text-info"> {{Lang::get('messages.maintenance_date_expired')}} 
            {{ Helpers\Helper::next_date($m->maintenance_date, $m->month_due)}}
            {{Lang::get('messages.maintenance_limit_milage')}} {{ $m->km_due + $m->maint_milage}}</p>

        @elseif(
        ((Helpers\Helper::status_maintenance($m->milage, $m->km_due, $m->maint_milage) >= 21))
        && ((Helpers\Helper::status_date($current_date, $m->month_due, $m->maintenance_date) >= 21))
        )
        <p class="text-danger">{{ $m->Make }}{{ $m->License}} {{Lang::get('messages.maintenance_expired')}}.</p>
        <p class="text-info"> {{Lang::get('messages.maintenance_date_expired')}} 
            {{ Helpers\Helper::next_date($m->maintenance_date, $m->month_due)}}
            {{Lang::get('messages.maintenance_limit_milage')}} {{ $m->km_due + $m->maint_milage}}
        </p>
        @elseif(
        ((Helpers\Helper::status_maintenance($m->milage, $m->km_due, $m->maint_milage) >= 21))
        && ((Helpers\Helper::status_date($current_date, $m->month_due, $m->maintenance_date) >= 0) 
        && (Helpers\Helper::status_date($current_date, $m->month_due, $m->maintenance_date) <= 4))
        )
        <p class="text-danger">{{ $m->Make }}{{ $m->License}} {{Lang::get('messages.maintenance_expired')}}.</p>
        <p class="text-info">  {{Lang::get('messages.maintenance_date_expired')}} 
            {{ Helpers\Helper::next_date($m->maintenance_date, $m->month_due)}}
            {{Lang::get('messages.maintenance_limit_milage')}} {{ $m->km_due + $m->maint_milage}}</p>
        @elseif(
        ((Helpers\Helper::status_maintenance($m->milage, $m->km_due, $m->maint_milage) >= 21))
        && ((Helpers\Helper::status_date($current_date, $m->month_due, $m->maintenance_date) >= 5) 
        && (Helpers\Helper::status_date($current_date, $m->month_due, $m->maintenance_date) <= 20))
        )
        <p class="text-danger">{{ $m->Make }}{{ $m->License}} {{Lang::get('messages.maintenance_expired')}}.</p>
        <p class="text-info"> {{Lang::get('messages.maintenance_date_expired')}} 
            {{ Helpers\Helper::next_date($m->maintenance_date, $m->month_due)}}
            {{Lang::get('messages.maintenance_limit_milage')}} {{ $m->km_due + $m->maint_milage}}</p>
        @endif                    
        @endforeach

    </div>
</div>
@stop

